<?php 
//echo 'asdf';exit;
if($data = file_get_contents("php://input","r")){
	 $uploadfile = 'uploads/'.$_SERVER['REQUEST_TIME'].'.jpg';
	if(!file_put_contents($uploadfile,$data)){
		echo '{"error":"失败"}';exit;
	}
}else{
$uploaddir = './uploads/';//设置存储路径 
$filename = $_FILES['Filedata']['name'];//获得选择的文件 
$uploadfile = $uploaddir . $filename;//存储文件路径 
$uploadfile = iconv('utf-8', 'gb2312', $uploadfile);//设置文件格式 
move_uploaded_file($_FILES['Filedata']['tmp_name'], $uploadfile);//开始上传 
$size = getimagesize("$uploadfile");
       $height = $size[1];
       $width = $size[0];

//print_r($return)
}
$return = array('path'=>$uploadfile,'post'=>$_POST);
echo json_encode($return);
//return json_encode($return);
?>
